package com.atguigu.ucenter.member.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取微信配置类
 * key 密钥 回调地址
 * 此处可以使用
 *
 * @author zy
 * @see EnableConfigurationProperties
 * @see ConfigurationProperties
 */
@Component
public class WxConfig implements InitializingBean {

    @Value("${wx.appid}")
    private String appid;
    @Value("${wx.appsecret}")
    private String appsecret;
    @Value("${wx.redirectUrl}")
    private String redirectUrl;

    public static String APPID = "";
    public static String APPSECRET = "";
    public static String REDIRECT_URL = "";

    @Override
    public void afterPropertiesSet() throws Exception {
        APPID = this.appid;
        APPSECRET = this.appsecret;
        REDIRECT_URL = this.redirectUrl;
    }
}
